<pre class='metadata'>
Title: CSS Fonts Module Level 5
Shortname: css-fonts
Level: 5
Status: ED
Prepare for TR: no
Work Status: exploring
Group: CSSWG
ED: https://drafts.csswg.org/css-fonts-5/
TR: https://www.w3.org/TR/css-fonts-5/
Previous Version: https://www.w3.org/TR/2021/WD-css-fonts-5-20211221/
!Delta Spec: yes
Former Editor: Myles C. Maxfield, Formerly of Apple Inc., mmaxfield@apple.com, w3cid 77180
Editor: Chris Lilley, W3C, https://svgees.us/, w3cid 1438
Abstract: This specification defines modifications to the existing <a href="https://drafts.csswg.org/css-fonts-4/">CSS Fonts 4</a> specification along with additional features.
Repository: w3c/csswg-drafts
Inline Github Issues: title
Default Highlight: css
WPT Path Prefix: css/css-fonts/
WPT Display: closed
</pre>

<pre class="link-defaults">
spec:css-color-4; type:property; text:color
spec:css-values; type:value; text:ex
spec:css22; type:value; for:/; text:block
spec:html; type:element; text:font
spec:css-fonts-4; type:property; text:font-size
spec:css-fonts-4; type:descriptor; text:font-language-override
spec:css-fonts-4;  type:property; text:font-family
spec:css-fonts-4;  type:property; text:font-style
spec:css-fonts-4;  type:property; text:font-weight
spec:css-fonts-4; type:descriptor; text:src
spec:css-cascade-5; type:dfn; text:computed value
spec:css-cascade-5; type:dfn; text:used value
</pre>

<pre class=biblio>
	{
		"avar2": {
			"title": "avar — Axis Variations Table Version 2",
			"href": "https://github.com/harfbuzz/boring-expansion-spec/blob/main/avar2.md",
			"publisher": "HarfBuzz",
			"date": "2022"
		}
	}
</pre>


<h2 id="introduction">
Introduction</h2>

The CSS Fonts Level 4 specification ([[!CSS-FONTS-4]]) describes the
controls CSS provides for selecting and using fonts within documents,
including support for variable fonts and color fonts.
The ideas here are additions or modifications to the properties and
rules defined in CSS Fonts Level 4.

This specification is currently a delta to the CSS Fonts Level 4 specification.
Do not assume that if something is not here, it has been dropped.



<h3 id="values">
Value Definitions</h3>

This specification follows the <a href="https://www.w3.org/TR/CSS2/about.html#property-defs">CSS property definition conventions</a> from [[!CSS2]]
using the <a href="https://www.w3.org/TR/css-values-3/#value-defs">value definition syntax</a> from [[!CSS-VALUES-3]].
Value types not defined in this specification are defined in CSS Values &amp; Units [[!CSS-VALUES-3]].
Combination with other CSS modules may expand the definitions of these value types.

In addition to the property-specific values listed in their definitions,
all properties defined in this specification
also accept the <a>CSS-wide keywords</a> as their property value.
For readability they have not been repeated explicitly.

<h2 id="basic-font-props">
Basic Font Properties</h2>

Issue(126):

<h3 id="font-family-prop">
Font family: the 'font-family!!property' property</h3>

<h4 id="generic-font-families">
Generic font families</h4>

In addition to the [[css-fonts-4#generic-font-families]]
in CSS Fonts Level 4, the following new generic font families are also defined.

Issue(4910):

<dl dfn-for="font-family,<generic-family>" dfn-type=value>
	<dt id="xxx-def"><dfn>xxx</dfn>
	<dd>
		Placeholder text for the xxx generic font family.
</dl>

Issue(4566):

<h3 id="font-weight-prop">Font weight: the 'font-weight!!property' property</h3>

Issue(2690):


<h3 id="font-style-prop">
Font style: the 'font-style!!property' property</h3>

Issue(4044):


<h3 id="font-size-adjust-prop">
Relative sizing: the 'font-size-adjust' property</h3>

	<pre class="propdef">
	Name: font-size-adjust
	Value: none | [ ex-height | cap-height | ch-width | ic-width | ic-height ]? [ from-font | <<number [0,∞]>> ]
	Initial: none
	Applies to: all elements and text
	Inherited: yes
	Percentages: N/A
	Computed value: the keyword ''font-size-adjust/none'', or a pair of a metric keyword and a <<number>>
	Animation type: discrete if the keywords differ, otherwise by computed value type
	</pre>

	For any given font size, the apparent size and effective legibility of text
	varies across fonts as a function of their design.
	For example,
	for bicameral scripts such as Latin or Cyrillic that
	distinguish between upper and lowercase letters,
	the relative height of lowercase letters
	compared to their uppercase counterparts
	is a determining factor of legibility.
	In situations where font fallback occurs,
	fallback fonts might not share
	the same ratios as the desired font family
	for key typographic metrics,
	and will thus appear to be a different size
	and possibly be less readable.

	<wpt>
		font-size-adjust-ic-height.html
	</wpt>

Issue(8792):

	The 'font-size-adjust' property provides a way
	to preserve the readability and apparent size of text
	when font fallback occurs.
	It does this by adjusting the used font size
	so that the specified metric is the same
	regardless of the font used.

	Values have the following meanings:

	<dl dfn-type=value dfn-for="font-size-adjust">
		<dt><dfn>none</dfn>
		<dd>
			No special 'font-size!!property' adjustment is applied.

		<dt><dfn>ex-height | cap-height | ch-width | ic-width | ic-height</dfn>
		<dd>
			Specifies the font metric to normalize,
			defaulting to ''font-size-adjust/ex-height'':

			<dl>
				<dt><dfn>ex-height</dfn>
				<dd>
					Normalize the <dfn dfn>aspect value</dfn> of the fonts,
					using the x-height divided by the font size.

				<dt><dfn>cap-height</dfn>
				<dd>
					Normalize the cap-height of the fonts,
					using the cap-height by the font size.

				<dt><dfn>ch-width</dfn>
				<dd>
					Normalize the horizontal narrow pitch of the fonts,
					using the advance width of “0” (ZERO, U+0030)
					divided by the font size.

				<dt><dfn>ic-width</dfn>
				<dd>
					Normalize the horizontal wide pitch of the font,
					using the advance width of “水” (CJK water ideograph, U+6C34)
					divided by the font size.

				<dt><dfn>ic-height</dfn>
				<dd>
					Normalize the vertical wide pitch of the font,
					using the advance height of “水” (CJK water ideograph, U+6C34)
					divided by the font size.
			</dl>

			ISSUE(6384):
			If the required font metric cannot be derived from a font,
			then that font’s size is not adjusted.

		<dt><dfn><<number [0,∞]>></dfn>
		<dd>
			Each font’s [=used value|used=] size is normalized
			to match the chosen font metric to
			this specified proportion of the [=computed value|computed=] 'font-size!!property'.
			In other words,
			for each glyph,
			the adjusted font size to use <var>u</var>
			is calculated as:

			<pre><var>u</var>  =  ( <var>m</var> / <var>m′</var> ) <var>s</var></pre>

			where:

			<pre>
			<var>s</var>  =  computed 'font-size!!property' value
			<var>m</var>  =  metric as specified by the 'font-size-adjust' property
			<var>m′</var> =  metric as specified in the actual font
			<var>u</var>  =  adjusted font-size to use
			</pre>

			Negative values are invalid.

		<dt><dfn>from-font</dfn>
		<dd>
			Computes to the <<number>> corresponding to
			the specified metric of the [=first available font=],
			if it exists. 
			Otherwise, the same as ''none''.
	</dl>

	<wpt>
		animations/font-size-adjust-composition.html
		animations/font-size-adjust-interpolation.html
		font-size-adjust-013.html
		font-size-adjust-014.html
		font-size-adjust-metrics-override.html
		font-size-adjust-text-orientation.html
		font-size-adjust-units-001.html
		parsing/font-size-adjust-computed.html
		parsing/font-size-adjust-invalid.html
		parsing/font-size-adjust-valid.html
	</wpt>

	<div class="example">
		The style defined below defines Verdana as the desired font family,
		but if Verdana is not available Futura or Times will be used.
		One paragraph also has font-size-adjust specified.

		<pre>
			p {
				font-family: Verdana, Futura, Times;
			}
			p.adj {
				font-size-adjust: 0.545;
			}

			&lt;p>Lorem ipsum dolor sit amet, ...&lt;/p>
			&lt;p class="adj">Lorem ipsum dolor sit amet, ...&lt;/p>
		</pre>

		Verdana has a relatively high aspect value of 0.545,
		meaning lowercase letters are relatively tall
		compared to uppercase letters,
		so at small sizes text appears legible.
		Times has a lower aspect value of 0.447,
		and so if fallback occurs,
		the text will be less legible at small sizes than Verdana
		unless font-size-adjust is also specified.

		Note: For text which uses diacritics,
		too large an x-height will actually decrease legibility
		as the diacritics become cramped.

		How text rendered in each of these fonts compares is shown below,
		the columns show text rendered in Verdana, Futura and Times.
		The same font-size value is used across cells
		within each row and red lines are included to show the differences in x-height.
		In the upper half, each row is rendered in the same font-size value.
		The same is true for the lower half,
		but in this half the 'font-size-adjust' property is also set
		to 0.545,
		so that the actual font size is adjusted
		to preserve the x-height of Verdana across each row.
		Note how small text remains relatively legible across each row in the lower half.

		<figure>
			<img alt="text with and without 'font-size-adjust'" src="images/fontsizeadjust.png" >
			<figcaption>Text with and without the use of 'font-size-adjust'</figcaption>
		</figure>
	</div>

	The value of 'font-size-adjust' affects the [=used value|used=] value of 'font-size!!property'
	but does not affect the [=computed value|computed=] value.
	Therefore it can affect the size of relative units
	that are based on font metrics
	such as <code>ex</code> and <code>ch</code>
	but does not affect the size of <code>em</code> units.
	Since numeric values of 'line-height'
	refer to the [=computed value|computed=] size of 'font-size!!property',
	'font-size-adjust' also does not affect the [=used value|used=] value of 'line-height'.

	Note: Since 'font-size-adjust' does not factor into the 'line-height',
	specifying a line height too tightly can result in overlapping lines of text.
	For example, when a fallback font with a low [=aspect value=]
	is normalized to match one with a high [=aspect value=],
	its ascenders and descenders are likely to extend outside the line box
	with ''line-height: 1''.

	The 'font-size-adjust' adjustment applies to any font that is selected
	but in typical usage it would be based
	on the corresponding metric value
	of the first (most desired) font in the 'font-family' list.
	If this is specified accurately,
	the <code>(<var>m</var>/<var>m′</var>)</code> term in the adjustment formula
	will resolve to <code>1</code> for the first font
	and no adjustment occurs for that font;
	and the rest of the fonts will resolve to match.
	If the value is specified inaccurately,
	text rendered using the first font in the family list
	will display differently in older user agents
	that don't support 'font-size-adjust'.

	<div class="example">
		Authors can calculate the <a>aspect value</a> for a given font
		by comparing spans with the same content
		but different 'font-size-adjust' properties.
		If the same font-size is used, the spans will match
		when the 'font-size-adjust' value is accurate for the given font.

		Two spans with borders are used to determine the <a>aspect value</a> of a font.
		The 'font-size!!property' is the same for both spans
		but the 'font-size-adjust' property is specified only for the right span.
		Starting with a value of 0.5,
		the aspect value can be adjusted
		until the borders around the two letters line up.

		<pre>
		p {
			font-family: Futura;
			font-size: 500px;
		}

		span {
			border: solid 1px red;
		}

		.adjust {
			font-size-adjust: 0.5;
		}

		&lt;p>&lt;span>b&lt;/span>&lt;span class="adjust">b&lt;/span>&lt;/p>
		</pre>

		<figure>
			<img alt="Futura with an aspect value of 0.5" src="images/beforefontsizeadjust.png" >
			<figcaption>Futura with an <a>aspect value</a> of 0.5</figcaption>
		</figure>

		The box on the right is a bit bigger than the one on the left, so the <a>aspect value</a> of this font is something less than 0.5.
		Adjust the value until the boxes align.
	</div>

	Note: If the specified metric has been overridden in ''@font-face'',
	e.g. by 'size-adjust',
	then the overridden metric will be used in the 'font-size-adjust' calculation.
	Consequently, applying 'font-size-adjust' and 'size-adjust' together
	means that 'size-adjust' appears to have no effect.

<h2 id="font-resources">
Font Resources</h2>

<h3 id="font-face-rule">
The <dfn id="at-font-face-rule">''@font-face''</dfn> rule</h3>

	Note: Descriptors are applied per-font rather than per-element.
	Multiple fonts can be used within an individual element
	e.g. for characters not supported by the [=first available font=].

<h3 id="src-desc">Font reference: the 'src' descriptor</h3>


<!-- same as CSS Fonts 4, keep the two in sync -->
<h4 id="font-face-src-parsing">Parsing the 'src!!descriptor' descriptor</h4>

The 'src!!descriptor' descriptor value must be parsed
according to section [[css-syntax#parse-comma-separated-list-of-component-values]].
Then each component value is parsed according to this grammar:


<pre><<url>> [ format(<<font-format>>)]? [ tech( <<font-tech>>#)]? | local(<<family-name>>)</pre>

<pre class="prod"><dfn id="font-format-values">&lt;font-format&gt;</dfn>
	 = [<<string>> | collection | embedded-opentype | opentype
		| svg | truetype | woff | woff2 ]</pre>

<pre class="prod"><dfn id="font-tech-values">&lt;font-tech&gt;</dfn>
	= [<<font-features-tech>> | <<color-font-tech>>
		| variations | palettes | incremental ]</pre>

<pre class="prod"><dfn id="font-features-tech-values">&lt;font-features-tech&gt;</dfn>
	= [features-opentype | features-aat | features-graphite]</pre>

<pre class="prod"><dfn id="color-font-tech-values">&lt;color-font-tech&gt;</dfn>
	= [color-COLRv0 | color-COLRv1 | color-SVG | color-sbix | color-CBDT ]</pre>

If a component value is parsed correctly
and is a supported [[css-fonts-4#font-format-definitions]] or
[[css-fonts-4#font-tech-definitions]],
add it to the list of supported sources.
If parsing a component value results in a parsing error
or its format or tech are unsupported,
do not add it to the list of supported sources.

If there are no supported entries at the end of this process,
the value for the 'src!!descriptor' descriptor is a parse error.

These parsing rules allow for graceful fallback of fonts
for user agents which don't support a particular font tech
or font format.

<div class="example" id="ex-incremental">
	For example,
	when incremental transfer is not supported,
	a woff2 compressed version of the font
	is supplied,
	for optimal performance.
	Then, for
	<a href="https://w3c.github.io/IFT/Overview.html">incremental transfer</a>,
	the raw uncompressed OpenType font is provided,
	portions of which will be loaded on demand.

	<pre>
	@font-face {
		font-family: "MyIncrementallyLoadedWebFont";
		src: url("FallbackURLForBrowsersWhichDontSupportIncrementalLoading.woff2") format("woff2");
		src: url("MyIncrementallyLoadedWebFont.otf") format(opentype)  tech(incremental);
	}
	</pre>
</div>


<h3 id="font-size-desc">
Font property descriptors: the 'font-size!!descriptor'
</h3>

Issue(806):

Issue(731):

<pre class='descdef'>
Name: font-size
Value: auto | [<<number>>]{1,2}
Initial: auto
For: @font-face
</pre>

<dl dfn-type="value" dfn-for="@font-face/font-size">
	<dt><dfn>auto</dfn></dt>
	<dd>
		The font matches any font size
	</dd>
	<dt><dfn><<number>></dfn></dt>
	<dd>
		If a single <<number>> is given
		the font matches that specific font size, only.
		If two <<number>>s are given,
		they specify a range of font sizes which will match.
	</dd>
</dl>


<h3 id="size-adjust-desc">
Glyph Size Multiplier:
the 'size-adjust' descriptor</h3>

	<pre class='descdef'>
	Name: size-adjust
	Value: <<percentage [0,∞]>>
	For: @font-face
	Initial: 100%
	</pre>

	The 'size-adjust' descriptor defines a multiplier
	for glyph outlines and metrics associated with this font,
	to allow the author to harmonize the designs of various fonts
	when rendered at the same 'font-size!!property'.

	All metrics associated with this font--
	including glyph advances, baseline tables, and overrides provided by ''@font-face'' descriptors--
	are scaled by the given percentage,
	as are the rendered glyph images.
	Consequently,
	any values derived from font metrics
	(such as ''ex'' and ''ch'' units,
	or the ''text-decoration-thickness/from-font'' value of 'text-decoration-thickness')
	are also affected when sourced from this font.
	However, the [=computed value|computed=] 'font-size!!property'
	(and thus any values that derive from it,
	such as ''em'' units, percentages in 'text-underline-offset', etc.)
	remains unaffected.

	Note: The 'size-adjust' descriptor functions similarly to
	the 'font-size-adjust' property,
	which essentially calculates an adjustment per font by matching ex heights,
	but likewise does not affect the [=computed value|computed=] 'font-size!!property'.

	<wpt>
		font-size-adjust-metrics-override.html
		size-adjust-01.html
		size-adjust-02.html
		size-adjust-03.html
	</wpt>

<!-- should this stay in Fonts 4 or be here in Fonts 5? -->

<h3 id="font-metrics-override-desc">
Line Height Font Metrics Overrides:
the 'ascent-override', 'descent-override', and 'line-gap-override' descriptors</h3>

	<pre class='descdef'>
	Name: ascent-override
	Value: [ normal | <<percentage [0,∞]>> ]{1,2}
	For: @font-face
	Initial: normal
	</pre>

	<pre class='descdef'>
	Name: descent-override
	Value: [ normal | <<percentage [0,∞]>> ]{1,2}
	For: @font-face
	Initial: normal
	</pre>

	<pre class='descdef'>
	Name: line-gap-override
	Value: [ normal | <<percentage [0,∞]>> ]{1,2}
	For: @font-face
	Initial: normal
	</pre>

	The 'ascent-override', 'descent-override', and 'line-gap-override' descriptors specify the
	<a spec="CSS-INLINE-3">ascent metric</a>,
	<a spec="CSS-INLINE-3">descent metric</a>, and
	<a spec="CSS-INLINE-3">line gap metric</a>
	of the font, respectively.
	The first value provides the value for the x axis,
	and the second value provides the value for the y axis
	(defaulting to ''ascent-override/normal'' if omitted).

	<dl dfn-for="ascent-override!!descriptor,descent-override!!descriptor,line-gap-override!!descriptor" dfn-type=value>
		<dt><dfn>normal</dfn>
		<dd>
			The corresponding metric value is obtained from the font as usual,
			as if this descriptor were absent from the <code>@font-face</code> block.

			Note: Since there are multiple sources of such metrics in some font formats,
			this can result in text layout that varies across UAs/platforms.

		<dt><dfn><<percentage>></dfn>
		<dd>
			The corresponding metric is replaced by
			the given percentage multiplied by the effective font size after adjustment.
	</dl>

	<wpt>
		ascent-descent-override.html
		font-size-adjust-metrics-override.html
		line-gap-override.html
		metrics-override-normal-keyword.html
	</wpt>

	The 'font-size-adjust' property is applied after the 'size-adjust' descriptor.

	Note: The consequence of applying 'font-size-adjust' after 'size-adjust' is that
	'size-adjust' appears to have no effect.

	Note: None of these descriptors affect the [=computed value|computation=] of
	'font-size!!property', 'line-height', or [=font-relative lengths=].
	They can, however, affect the behavior of ''line-height: normal''
	and more generally the baseline alignment of [=inline-level=] content.

	Note: Since these metrics are only applicable in the [=block axis=],
	the y-axis value will only be used
	when [=typesetting upright=] in vertical [=typographic modes=].

<div class="example">
	The percentage is resolved against different font sizes for different elements.

	<pre>
	@font-face {
	  font-family: overridden-font;
	  ascent-override: 50%;
	  ...
	}

	&lt;span style="font-family: overridden-font; font-size: 20px;"&gt;
	  Outer span content
	  &lt;span style="font-size: 150%;"&gt;Inner span content&lt;/span&gt;
	&lt;/span&gt;
	</pre>

	The outer span uses an <a spec="CSS-INLINE-3" lt="ascent metric">ascent</a> value of
	10px, whereas the inner span uses 15px.
</div>

<div class="example">
	We may override the metrics of a local fallback font to match the primary font, which
	is a web font. This reduces layout shifting when switching from fallback to the
	primary font.

	<pre>
	@font-face {
	  font-family: cool-web-font;
	  src: url("https://example.com/font.woff");
	}

	@font-face {
	  font-family: fallback-to-local;
	  src: local(Some Local Font);
	  /* Override metric values to match cool-web-font */
	  ascent-override: 125%;
	  descent-override: 25%;
	  line-gap-override: 0%;
	  size-adjust: 96%;
	}

	&lt;div style="font-family: cool-web-font, fallback-to-local"&gt;Title goes here&lt;/div&gt;
	&lt;img src="https://example.com/largeimage" alt="A large image that you don't want to shift"&gt;
	</pre>

	The image will not be shifted as much when the user agent finishes loading and
	switches to use the web font (assuming the override values are similar to the web font's
	natural metrics).
</div>

<h3 id="font-sup-sub-override-desc">
Superscript and subscript metrics overrides:
the 'superscript-position-override', 'subscript-position-override','superscript-size-override' and 'subscript-size-override' descriptors</h3>

	<pre class='descdef'>
	Name: superscript-position-override
	Value: [ normal | from-font | <<percentage>> ]{1,2}
	For: @font-face
	Initial: normal
	</pre>

	<pre class='descdef'>
	Name: subscript-position-override
	Value: [ normal | from-font | <<percentage>> ]{1,2}
	For: @font-face
	Initial: normal
	</pre>

	<pre class='descdef'>
	Name: superscript-size-override
	Value: [ normal | from-font | <<percentage [0,∞]>> ]{1,2}
	For: @font-face
	Initial: normal
	</pre>

	<pre class='descdef'>
	Name: subscript-size-override
	Value: [ normal | from-font | <<percentage [0,∞]>> ]{1,2}
	For: @font-face
	Initial: normal
	</pre>

	The 'superscript-position-override', 'subscript-position-override',
	'superscript-size-override', and 'subscript-size-override' descriptors
	specify the superscript offset, subscript offset, superscript size, and subscript size
	metrics of the font, respectively,
	which are used to synthesize glyphs when required by 'font-variant-position'.
	The first value provides the value for the x axis,
	and the second value provides the value for the y axis
	(defaulting to the first value if omitted).

	<dl dfn-for="superscript-position-override!!descriptor,subscript-position-override!!descriptor,superscript-size-override!!descriptor,subscript-size-override!!descriptor" dfn-type=value>
		<dt><dfn>normal</dfn>
		<dd>
			The UA determines what metrics value to use,
			whether derived from the font or from some heuristic.

		<dt><dfn>from-font</dfn>
		<dd>
			The corresponding metric in the font data is used, if any.
			(If the metric is missing, same as ''superscript-position-override/normal''.)

		<dt><dfn><<percentage>></dfn>
		<dd>
			The corresponding metric is replaced by
			the given percentage multiplied by the used font size.
	</dl>

	Note: Since these metrics are only applicable in the [=block axis=],
	the y-axis value will only be used
	when [=typesetting upright=] in [=vertical typographic modes=].

<h2 id="font-rend-props">
Font Feature Properties</h2>


<h3 id="font-language-override-prop">Font language override: the 'font-language-override' property</h3>

Issue(5484):


<h2 id="font-feature-variation-resolution">
Font Feature and Variation Resolution</h2>

Issue(5635):


<h2 id="font-variation-props">
Font Variation Properties</h2>


<h3 id="font-optical-sizing-def">
Optical sizing control: the 'font-optical-sizing' property</h3>

Issue(5466):


<!-- This might get moved here -->
<!--
    <h2 id="color-font-support">
Color Font Support</h2>
-->

<h2 id="font-technologies-formats">
	Font Technologies and Formats
</h2>

<h3 id="font-tech-definitions">Font tech</h3>

This section expands upon [[css-fonts-4#font-tech-definitions]].

The 'avar2' tech refers to support for version 2 of OpenType axis variations [[!avar2]],
for flexible variation axis remapping.

<div class="example" id="ex-avar2">
	For example, a font using variation axis remapping is loaded only if supported:

	<pre>
		@font-face {
			font-family: 'Roboto Flex';
			src: url('RobotoFlex-VF-avar2.woff2') format(woff2) tech(variations, avar2);
			src: url('RobotoFlex-VF.woff2') format(woff2) tech(variations);
			font-weight: 100 1000;
			font-stretch: 25% 151%;
		}
	</pre>
</div>

<!--
 ███████  ████████        ██ ████████  ██████  ████████       ██     ██  ███████  ████████  ████████ ██
██     ██ ██     ██       ██ ██       ██    ██    ██          ███   ███ ██     ██ ██     ██ ██       ██
██     ██ ██     ██       ██ ██       ██          ██          ████ ████ ██     ██ ██     ██ ██       ██
██     ██ ████████        ██ ██████   ██          ██          ██ ███ ██ ██     ██ ██     ██ ██████   ██
██     ██ ██     ██ ██    ██ ██       ██          ██          ██     ██ ██     ██ ██     ██ ██       ██
██     ██ ██     ██ ██    ██ ██       ██    ██    ██          ██     ██ ██     ██ ██     ██ ██       ██
 ███████  ████████   ██████  ████████  ██████     ██          ██     ██  ███████  ████████  ████████ ████████
-->

<h2 id="object-model">
	Object Model</h2>

	This section expands upon [[css-fonts-4#object-model]].
	
	The contents of ''@font-face'' and ''@font-feature-values'' rules
	can be accessed via the following extensions to the CSS Object Model.
	
	<wpt>
		idlharness.html
	</wpt>
	
	<h3 id="om-fontface">
	The <code id="cssfontfacerule2">CSSFontFaceRule</code> interface</h3>
	
	The <dfn id="cssfontfacerule-interface">CSSFontFaceRule</dfn> interface represents a <<@font-face>> rule.
	
	<pre class="idl">
	[Exposed=Window]
	interface CSSFontFaceDescriptors : CSSStyleDeclaration {
		attribute [LegacyNullToEmptyString] CSSOMString src;
		attribute [LegacyNullToEmptyString] CSSOMString fontFamily;
		attribute [LegacyNullToEmptyString] CSSOMString font-family;
		attribute [LegacyNullToEmptyString] CSSOMString fontStyle;
		attribute [LegacyNullToEmptyString] CSSOMString font-style;
		attribute [LegacyNullToEmptyString] CSSOMString fontWeight;
		attribute [LegacyNullToEmptyString] CSSOMString font-weight;
		attribute [LegacyNullToEmptyString] CSSOMString fontStretch;
		attribute [LegacyNullToEmptyString] CSSOMString font-stretch;
		attribute [LegacyNullToEmptyString] CSSOMString fontWidth;
		attribute [LegacyNullToEmptyString] CSSOMString font-width;
		attribute [LegacyNullToEmptyString] CSSOMString fontSize;
		attribute [LegacyNullToEmptyString] CSSOMString font-size;
		attribute [LegacyNullToEmptyString] CSSOMString sizeAdjust;
		attribute [LegacyNullToEmptyString] CSSOMString size-adjust;
		attribute [LegacyNullToEmptyString] CSSOMString unicodeRange;
		attribute [LegacyNullToEmptyString] CSSOMString unicode-range;
		attribute [LegacyNullToEmptyString] CSSOMString fontFeatureSettings;
		attribute [LegacyNullToEmptyString] CSSOMString font-feature-settings;
		attribute [LegacyNullToEmptyString] CSSOMString fontVariationSettings;
		attribute [LegacyNullToEmptyString] CSSOMString font-variation-settings;
		attribute [LegacyNullToEmptyString] CSSOMString fontNamedInstance;
		attribute [LegacyNullToEmptyString] CSSOMString font-named-instance;
		attribute [LegacyNullToEmptyString] CSSOMString fontDisplay;
		attribute [LegacyNullToEmptyString] CSSOMString font-display;
		attribute [LegacyNullToEmptyString] CSSOMString fontLanguageOverride;
		attribute [LegacyNullToEmptyString] CSSOMString font-language-override;
		attribute [LegacyNullToEmptyString] CSSOMString ascentOverride;
		attribute [LegacyNullToEmptyString] CSSOMString ascent-override;
		attribute [LegacyNullToEmptyString] CSSOMString descentOverride;
		attribute [LegacyNullToEmptyString] CSSOMString descent-override;
		attribute [LegacyNullToEmptyString] CSSOMString lineGapOverride;
		attribute [LegacyNullToEmptyString] CSSOMString line-gap-override;
		attribute [LegacyNullToEmptyString] CSSOMString superscriptPositionOverride;
		attribute [LegacyNullToEmptyString] CSSOMString superscript-position-override;
		attribute [LegacyNullToEmptyString] CSSOMString subscriptPositionOverride;
		attribute [LegacyNullToEmptyString] CSSOMString subscript-position-override;
		attribute [LegacyNullToEmptyString] CSSOMString superscriptSizeOverride;
		attribute [LegacyNullToEmptyString] CSSOMString superscript-size-override;
		attribute [LegacyNullToEmptyString] CSSOMString subscriptSizeOverride;
		attribute [LegacyNullToEmptyString] CSSOMString subscript-size-override;
	};
	
	[Exposed=Window]
	interface CSSFontFaceRule : CSSRule {
		[SameObject, PutForwards=cssText] readonly attribute CSSFontFaceDescriptors style;
	};
	</pre>

<h2 id="security">Security Considerations</h2>

No new security considerations have been reported on this specification.

<h2 id="privacy">Privacy Considerations</h2>

No new privacy considerations have been reported on this specification.


<h2 id="acknowledgments">
Acknowledgments</h2>

	Firstly, the editors would like to thank all of the
	<a href="https://www.w3.org/TR/css-fonts-4/#acknowledgments">contributors to the previous level of this module</a>.

	Secondly, we would like to acknowledge
	Dave Crossland from Google,
	Bernhard Fey from RealObjects,
	Xiaocheng Hu from Google,
	Jonathan Kew from Mozilla,
	and
	Laurence Penney
	for their contributions to the improvements in this Level 5.

<h2 id="changes">
Changes
</h2>

<h3 id="changes-20260206">Changes since the <a href="https://www.w3.org/TR/2024/WD-css-fonts-5-20240206/">WD of 6 February 2024</a></h3>

<ul>
	<!-- to 18 Dec 2024 -->
	<li>Added the avar2 font tech</li>
	<li>Updated the incremental example to conform to the latest IFT specification</li>
</ul>

<h3 id="changes-20211221">Changes since the <a href="https://www.w3.org/TR/2021/WD-css-fonts-5-20211221/">WD of 21 December 2021</a> </h3>

<ul>
	<!-- to 31 Jan 2024  -->
	<li>Corrected the initial value for the font-size descriptor</li>
	<li>Set a range for the grammar of font-size-adjust number</li>
	<li>Changed grammar of local() to use family-name instead for font-face-name</li>
	<li>Updated to current incremental font download keywords</li>
	<li>Made feature-* plural for consistency with CSS Conditional 5, and 11.1 Font tech</li>
	<li>Normalized infinity to ∞ in range notation </li>
	<li>Fixed a typo in the tech() function</li>
</ul>

<h3 id="changes-20210729">Changes since the <a href="https://www.w3.org/TR/2021/WD-css-fonts-5-20210729/">WD of 2021-07-29</a></h3>

<ul>
	<li>Renamed technology to tech</li>
	<li>Security and Privacy are now separate sections</li>
	<li>Fixed font-technology grammar</li>
	<li>Copied section on parsing src descriptor from CSS Fonts 4</li>
</ul>

<h3 id="changes-20210629">Changes since the <a href="https://www.w3.org/TR/2021/WD-css-fonts-5-20210629/">FPWD of 2021-06-29</a></h3>

<ul>
	<li>Removed scary warning notice</li>
	<li>Added incremental font technology to supports</li>
</ul>

<!-- WPT for Levels 4 and 3 of CSS Fonts, ignore -->

<wpt hidden>
	alternates-order.html
	animations/font-palette-animation-not-specified-endpoints.html
	animations/font-palette-interpolation.html
	animations/font-size-interpolation-001.html
	animations/font-size-interpolation-002.html
	animations/font-size-interpolation-003.html
	animations/font-stretch-interpolation.html
	animations/font-style-interpolation.html
	animations/font-variation-settings-composition.html
	animations/font-variation-settings-interpolation.html
	animations/multiple-elements-font-palette-animation.html
	animations/system-fonts.html
	calc-in-font-variation-settings.html
	cjk-kerning.html
	downloadable-font-in-iframe-print.html
	downloadable-font-print.html
	fallback-remote-to-data-url.html
	fallback-url-to-local.html
	first-available-font-001.html
	first-available-font-002.html
	first-available-font-003.html
	first-available-font-004.html
	first-available-font-005.html
	first-available-font-006.html
	first-available-font-007.html
	font-colorization.html
	font-default-01.html
	font-default-02.html
	font-default-03.html
	font-default-04.html
	font-display/font-display-change.html
	font-display/font-display-failure-fallback.html
	font-display/font-display-preload.html
	font-display/font-display.html
	font-face-range-order.html
	font-face-stretch-auto-static.html
	font-face-stretch-auto-variable.html
	font-face-stretch-default-variable.html
	font-face-style-auto-static.html
	font-face-style-auto-variable.html
	font-face-style-default-variable.html
	font-face-unicode-range-2.html
	font-face-unicode-range-nbsp.html
	font-face-unicode-range.html
	font-face-weight-auto-static.html
	font-face-weight-auto-variable.html
	font-face-weight-default-variable.html
	font-family-name-000.xht
	font-family-name-001.xht
	font-family-name-002.xht
	font-family-name-003.xht
	font-family-name-004.xht
	font-family-name-005.xht
	font-family-name-006.xht
	font-family-name-007.xht
	font-family-name-008.xht
	font-family-name-009.xht
	font-family-name-010.xht
	font-family-name-011.xht
	font-family-name-012.xht
	font-family-name-013.xht
	font-family-name-014.xht
	font-family-name-015.xht
	font-family-name-016.xht
	font-family-name-017.xht
	font-family-name-018.xht
	font-family-name-019.xht
	font-family-name-020.xht
	font-family-name-021.xht
	font-family-name-022.xht
	font-family-name-023.xht
	font-family-name-024.xht
	font-family-name-025.html
	font-family-src-quoted.html
	font-feature-resolution-001.html
	font-feature-resolution-002.html
	font-feature-settings-descriptor-01.html
	font-feature-settings-serialization-001.html
	font-feature-settings-tibetan.html
	font-features-across-space-1.html
	font-features-across-space-2.html
	font-features-across-space-3.html
	font-kerning-01.html
	font-kerning-02.html
	font-kerning-03.html
	font-kerning-04.html
	font-kerning-05.html
	font-language-override-01.html
	font-language-override-02.html
	font-language-override-03.html
	font-palette-10.html
	font-palette-11.html
	font-palette-12.html
	font-palette-13.html
	font-palette-14.html
	font-palette-15.html
	font-palette-16.html
	font-palette-17.html
	font-palette-18.html
	font-palette-19.html
	font-palette-2.html
	font-palette-20.html
	font-palette-21.html
	font-palette-22.html
	font-palette-23.html
	font-palette-24.html
	font-palette-25.html
	font-palette-26.html
	font-palette-27.html
	font-palette-28.html
	font-palette-29.html
	font-palette-3.html
	font-palette-30.html
	font-palette-31.html
	font-palette-32.html
	font-palette-33.html
	font-palette-34.html
	font-palette-35.html
	font-palette-36.html
	font-palette-4.html
	font-palette-5.html
	font-palette-6.html
	font-palette-7.html
	font-palette-8.html
	font-palette-9.html
	font-palette-add-2.html
	font-palette-add.html
	font-palette-empty-font-family.html
	font-palette-modify-2.html
	font-palette-modify.html
	font-palette-non-ident-font-family.html
	font-palette-remove-2.html
	font-palette-remove.html
	font-palette-vs-shorthand.html
	font-palette.html
	font-shorthand-serialization-001.html
	font-shorthand-serialization-font-stretch.html
	font-shorthand-serialization-prevention.html
	font-shorthand-subproperties-reset.html
	font-size-adjust-001.html
	font-size-adjust-002.html
	font-size-adjust-003.xht
	font-size-adjust-005.xht
	font-size-adjust-006.xht
	font-size-adjust-007.xht
	font-size-adjust-008.xht
	font-size-adjust-009.html
	font-size-adjust-010.html
	font-size-adjust-011.html
	font-size-adjust-012.html
	font-size-adjust-order-001.html
	font-size-adjust-reload.html
	font-size-adjust-zero-1.html
	font-size-adjust-zero-2.html
	font-size-relative-across-calc-ff-bug-001.html
	font-size-xxx-large.html
	font-size-zero-1-ref.html
	font-size-zero-1.html
	font-size-zero-2.html
	font-stretch-01.html
	font-stretch-02.html
	font-stretch-03.html
	font-stretch-04.html
	font-stretch-05.html
	font-stretch-06.html
	font-stretch-07.html
	font-stretch-08.html
	font-stretch-09.html
	font-stretch-10.html
	font-stretch-11.html
	font-stretch-12.html
	font-stretch-13.html
	font-stretch-14.html
	font-stretch-15.html
	font-stretch-16.html
	font-stretch-17.html
	font-stretch-18.html
	font-style-angle.html
	font-synthesis-01.html
	font-synthesis-02.html
	font-synthesis-03.html
	font-synthesis-04.html
	font-synthesis-05.html
	font-synthesis-06.html
	font-synthesis-07.html
	font-synthesis-08.html
	font-synthesis-position-001.html
	font-synthesis-small-caps-first-letter.html
	font-synthesis-small-caps-first-line.html
	font-synthesis-small-caps-not-applied.html
	font-synthesis-small-caps.html
	font-synthesis-style-binary.html
	font-synthesis-style-first-letter.html
	font-synthesis-style-first-line.html
	font-synthesis-style.html
	font-synthesis-weight-binary.html
	font-synthesis-weight-first-letter.html
	font-synthesis-weight-first-line.html
	font-synthesis-weight.html
	font-variant-01.html
	font-variant-02.html
	font-variant-03.html
	font-variant-04.html
	font-variant-alternates-01.html
	font-variant-alternates-02.html
	font-variant-alternates-03.html
	font-variant-alternates-04.html
	font-variant-alternates-05.html
	font-variant-alternates-06.html
	font-variant-alternates-07.html
	font-variant-alternates-08.html
	font-variant-alternates-09.html
	font-variant-alternates-10.html
	font-variant-alternates-11.html
	font-variant-alternates-12.html
	font-variant-alternates-13.html
	font-variant-alternates-14.html
	font-variant-alternates-15.html
	font-variant-alternates-16.html
	font-variant-alternates-17.html
	font-variant-alternates-18.html
	font-variant-alternates-19.html
	font-variant-alternates-layers.html
	font-variant-alternates-parsing.html
	font-variant-caps-01.html
	font-variant-caps-02.html
	font-variant-caps-03.html
	font-variant-caps-04.html
	font-variant-caps-05.html
	font-variant-caps-06.html
	font-variant-caps-07.html
	font-variant-caps.html
	font-variant-east-asian-01.html
	font-variant-east-asian-02.html
	font-variant-east-asian-03.html
	font-variant-east-asian-04.html
	font-variant-east-asian-05.html
	font-variant-east-asian-06.html
	font-variant-east-asian-07.html
	font-variant-east-asian-08.html
	font-variant-east-asian-09.html
	font-variant-east-asian-10.html
	font-variant-east-asian.html
	font-variant-emoji-1.html
	font-variant-emoji-2.html
	font-variant-ligatures-01.html
	font-variant-ligatures-02.html
	font-variant-ligatures-03.html
	font-variant-ligatures-04.html
	font-variant-ligatures-05.html
	font-variant-ligatures-06.html
	font-variant-ligatures-07.html
	font-variant-ligatures-08.html
	font-variant-ligatures-09.html
	font-variant-ligatures-10.html
	font-variant-ligatures-11.optional.html
	font-variant-ligatures.html
	font-variant-numeric-01.html
	font-variant-numeric-02.html
	font-variant-numeric-03.html
	font-variant-numeric-04.html
	font-variant-numeric-05.html
	font-variant-numeric-06.html
	font-variant-numeric-07.html
	font-variant-numeric-08.html
	font-variant-numeric-09.html
	font-variant-numeric.html
	font-variant-position-01.html
	font-variant-position-02.html
	font-variant-position-03.html
	font-variant-position-04.html
	font-variant-position-05.html
	font-variant-position.html
	font-variation-settings-serialization-001.html
	font-weight-bolder-001.xht
	font-weight-lighter-001.xht
	font-weight-normal-001.xht
	format-specifiers-variations.html
	generic-family-keywords-001.html
	generic-family-keywords-002.html
	generic-family-keywords-003.html
	hiragana-katakana-kerning.html
	idlharness.html
	inheritance.html
	language-specific-01.html
	matching/fixed-stretch-style-over-weight.html
	matching/font-unicode-PUA.html
	matching/range-descriptor-reversed.html
	matching/stretch-distance-over-weight-distance.html
	matching/style-ranges-over-weight-direction.html
	palette-mix-computed.html
	palette-values-rule-add-2.html
	palette-values-rule-add.html
	palette-values-rule-delete-2.html
	palette-values-rule-delete.html
	parsing/font-computed.html
	parsing/font-face-src-format.html
	parsing/font-face-src-list.html
	parsing/font-face-src-local.html
	parsing/font-face-src-tech.html
	parsing/font-family-computed.html
	parsing/font-family-invalid.html
	parsing/font-family-valid.html
	parsing/font-feature-settings-computed.html
	parsing/font-feature-settings-invalid.html
	parsing/font-feature-settings-valid.html
	parsing/font-invalid.html
	parsing/font-kerning-computed.html
	parsing/font-kerning-invalid.html
	parsing/font-kerning-valid.html
	parsing/font-language-override-computed.html
	parsing/font-language-override-invalid.html
	parsing/font-language-override-valid.html
	parsing/font-optical-sizing-computed.html
	parsing/font-optical-sizing-invalid.html
	parsing/font-optical-sizing-valid.html
	parsing/font-palette-computed.html
	parsing/font-palette-invalid.html
	parsing/font-palette-valid.html
	parsing/font-palette-values-invalid.html
	parsing/font-palette-values-valid.html
	parsing/font-shorthand-variant.html
	parsing/font-size-computed.html
	parsing/font-size-invalid.html
	parsing/font-size-valid.html
	parsing/font-style-computed.html
	parsing/font-style-invalid.html
	parsing/font-style-valid.html
	parsing/font-synthesis-computed.html
	parsing/font-synthesis-invalid.html
	parsing/font-synthesis-position-invalid.html
	parsing/font-synthesis-position-valid.html
	parsing/font-synthesis-small-caps-invalid.html
	parsing/font-synthesis-small-caps-valid.html
	parsing/font-synthesis-style-invalid.html
	parsing/font-synthesis-style-valid.html
	parsing/font-synthesis-valid.html
	parsing/font-synthesis-weight-invalid.html
	parsing/font-synthesis-weight-valid.html
	parsing/font-valid.html
	parsing/font-variant-alternates-invalid.html
	parsing/font-variant-alternates-valid.html
	parsing/font-variant-caps-computed.html
	parsing/font-variant-caps-invalid.html
	parsing/font-variant-caps-valid.html
	parsing/font-variant-east-asian-computed.html
	parsing/font-variant-east-asian-invalid.html
	parsing/font-variant-east-asian-valid.html
	parsing/font-variant-emoji-computed.html
	parsing/font-variant-emoji-invalid.html
	parsing/font-variant-emoji-valid.html
	parsing/font-variant-invalid.html
	parsing/font-variant-ligatures-computed.html
	parsing/font-variant-ligatures-invalid.html
	parsing/font-variant-ligatures-valid.html
	parsing/font-variant-numeric-computed.html
	parsing/font-variant-numeric-invalid.html
	parsing/font-variant-numeric-valid.html
	parsing/font-variant-position-computed.html
	parsing/font-variant-position-invalid.html
	parsing/font-variant-position-valid.html
	parsing/font-variant-serialization.html
	parsing/font-variant-valid.html
	parsing/font-variation-settings-computed.html
	parsing/font-variation-settings-invalid.html
	parsing/font-variation-settings-valid.html
	parsing/font-weight-computed.html
	parsing/font-weight-invalid.html
	parsing/font-weight-valid.html
	quoted-generic-ignored.html
	rem-in-monospace.html
	standard-font-family-10.html
	standard-font-family-11.html
	standard-font-family-12.html
	standard-font-family-13.html
	standard-font-family-14.html
	standard-font-family-15.html
	standard-font-family-16.html
	standard-font-family-17.html
	standard-font-family-18.html
	standard-font-family-19.html
	standard-font-family-2.html
	standard-font-family-20.html
	standard-font-family-3.html
	standard-font-family-4.html
	standard-font-family-5.html
	standard-font-family-6.html
	standard-font-family-7.html
	standard-font-family-8.html
	standard-font-family-9.html
	standard-font-family.html
	system-fonts-serialization.tentative.html
	system-ui-ar.html
	system-ui-ja-vs-zh.html
	system-ui-ja.html
	system-ui-mixed.html
	system-ui-ur-vs-ar.html
	system-ui-ur.html
	system-ui-zh.html
	system-ui.html
	test-synthetic-italic-2.html
	test-synthetic-italic-3.html
	test_datafont_same_origin.html
	test_font_family_parsing.html
	test_font_feature_values_parsing.html
	variations/at-font-face-descriptors.html
	variations/at-font-face-descriptors.html
	variations/at-font-face-font-matching.html
	variations/font-descriptor-range-reversed.html
	variations/font-opentype-collections.html
	variations/font-parse-numeric-stretch-style-weight.html
	variations/font-shorthand.html
	variations/font-slant-1.html
	variations/font-slant-2a.html
	variations/font-slant-2b.html
	variations/font-slant-2c.html
	variations/font-slant-3.html
	variations/font-stretch.html
	variations/font-style-interpolation.html
	variations/font-style-parsing.html
	variations/font-variation-settings-inherit.html
	variations/font-weight-interpolation.html
	variations/font-weight-lighter-bolder.html
	variations/font-weight-matching-installed-fonts.html
	variations/font-weight-matching.html
	variations/font-weight-metrics.html
	variations/font-weight-parsing.html
	variations/slnt-backslant-variable.html
	variations/slnt-variable.html
	variations/variable-box-font.html
	variations/variable-gpos-m2b.html
	variations/variable-gsub.html
	variations/variable-opsz-size-adjust.html
	variations/variable-opsz.html
	downloadable-font-scoped-to-document.html
	font-face-sign-function.html
	font-size-adjust-interpolation-math-functions.html
	font-size-sign-function.html
	font-stretch-interpolation-math-functions.html
	font-style-sign-function.html
	font-variant-emoji-003.html
	font-variant-emoji-004.html
	matching/font-unicode-PUA-primary-font.html
	parsing/font-face-size-adjust.html
	parsing/font-stretch-alias.html
	synthetic-bold-space-width.html
	variable-in-feature-crash.html
	variable-in-font-variation-settings.html
	variation-sequences.html
	web-font-no-longer-accessible-when-stylesheet-removed.html
	font-face-local-not-family.html
	font-face-style-normal.html
	font-feature-settings-descriptor-02.html
	font-feature-settings-descriptor-binary.html
	font-palette-23b.html
	font-palette-relative-color-crash.html
	font-synthesis-style-oblique-only.html
	font-variant-caps-invalidation-container-sizing.html
	font-variant-emoji-005.html
	font-variation-settings-calc.html
	font-variation-settings-descriptor-01.html
	font-variation-settings-descriptor-02.html
	font-variation-settings-descriptor-03.html
	font-variation-settings-descriptor-04.html
	font-variation-settings-serialization-002.html
	font-weight-sign-function.html
	italic-oblique-fallback.html
	lang-attribute-affects-rendering-of-second-text-run.html
	lang-attribute-affects-rendering.html
	matching/font-unicode-presented-as-emoji-outline.html
	parsing/font-width-computed.html
	parsing/font-width-invalid.html
	parsing/font-width-valid.html
	test-synthetic-bold.html
	test-synthetic-italic.html
	font-size-zero-3.html
  	font-synthesis-weight-webfont-bold.html
</wpt>

<!-- 
	Avoid crash tests :)
-->

<wpt hidden>
	crash-font-face-invalid-descriptor.html
	crash-large-grapheme-cluster.html
	font-face-local-css-wide-keyword-crash.html
	infinite-size-crash.html
	math-script-level-and-math-style/math-depth-001-crash.html
	font-features-two-stylesheets-crash.html
</wpt>	

<!-- 
		Also tests where it is completely unclear 
		what spec section, if any, they are testing.

 -->

<wpt hidden>
	font-size-monospace-adjust.html
	discrete-no-interpolation.html
	separators.html
	font-size-adjust-generic-font-fallback-crash.html
	font-size-adjust-nan-crash.html
	size-adjust-unicode-range-system-fallback.html
	rcap-in-monospace.html
	rch-in-monospace.html
	rex-in-monospace.html
	ric-in-monospace.html
	rlh-in-monospace.html
</wpt>	
